﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="User.aspx.cs" Inherits="Admin_User" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head id="Head1" runat="server">
    <title>کاربران</title>
    <link href="../App_Themes/Default/css/B_Yekan.css" rel="stylesheet" type="text/css" />
    <link href="../App_Themes/Default/css/reset.css" rel="stylesheet" type="text/css" />
    <link href="../App_Themes/Default/css/slider.css" rel="stylesheet" type="text/css" />
    <link href="../App_Themes/Default/css/style.css" rel="stylesheet" type="text/css" />
    <link href="../App_Themes/Default/css/grid_12.css" rel="stylesheet" type="text/css" />
    <link href="../App_Themes/Default/css/jqtransform.css" rel="stylesheet" type="text/css" />
    <script src="../App_Themes/Default/js/jquery-1.7.min.js" type="text/javascript"></script>
    <script src="../App_Themes/Default/js/jquery.easing.1.3.js" type="text/javascript"></script>
    <script src="../App_Themes/Default/js/jquery.jqtransform.js" type="text/javascript"></script>
    <script src="../App_Themes/Default/js/FF-cash.js" type="text/javascript"></script>
    <script src="../App_Themes/Default/js/cufon-replace.js" type="text/javascript"></script>
    <script src="../App_Themes/Default/js/tms-0.4.x.js" type="text/javascript"></script>
    <script>
        $(document)
    .ready(function () {
        $('.form-1')
        .jqTransform();
        $('.slider')
        ._TMS({
            show: 0,
            pauseOnHover: true,
            prevBu: '.prev',
            nextBu: '.next',
            playBu: false,
            duration: 1000,
            preset: 'fade',
            pagination: true,
            pagNums: false,
            slideshow: 7000,
            numStatus: false,
            banners: false,
            waitBannerAnimation: false,
            progressBar: false
        })
    });
    </script>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="../App_Themes/Default/js/html5.js"></script>
<link rel="stylesheet" type="text/css" href="../App_Themes/Default/css/ie.css" />
<![endif]-->
</head>
<body>
    <form id="Form1" runat="server">
    <div class="main">
        <!--==============================header=================================-->
        <div class="header">
            <div>
                <h1>
                    <a href="../Default.aspx">
                        <img src="../App_Themes/Default/images/logo.jpg" alt="" /></a></h1>
                <div id="slide">
                    <div class="slider">
                        <ul class="items">
                            <li>
                                <img src="../App_Themes/Default/images/slider-1.jpg" alt="" /></li>
                            <li>
                                <img src="../App_Themes/Default/images/slider-2.jpg" alt="" /></li>
                            <li>
                                <img src="../App_Themes/Default/images/slider-3.jpg" alt="" /></li>
                            <li>
                                <img src="../App_Themes/Default/images/slider-4.jpg" alt="" /></li>
                        </ul>
                    </div>
                    <a href="#" class="prev"></a><a href="#" class="next"></a>
                </div>
                <div class="nav">
                    <ul class="menu">
                          <li><a id="A1" href="~/Admin/Confirm.aspx" runat="server">آزمایش های تایید شده</a></li>
            <li><a id="A2" href="~/Admin/Paper.aspx" runat="server">مقاله ها</a></li>
            <li><a id="A3" href="~/Admin/Help.aspx" runat="server">راهنمای پذیرش</a></li>
            <li><a id="A4" href="~/Admin/Gallery.aspx" runat="server">گالری</a></li>
            <li><a id="A5" href="~/Admin/Sentence.aspx" runat="server">جمله روز</a></li>
            <li><a id="A6" href="~/Admin/Category.aspx" runat="server">گروه آزمایش</a></li>
            <li><a id="A7" href="~/Admin/CategoryItem.aspx" runat="server">آزمایشات</a></li>
            <li class="current" ><a id="A8" href="~/Admin/User.aspx" runat="server">کاربران</a></li>
            <li><a id="A9" href="~/Admin/ChangePassword.aspx" runat="server">تغییر رمز</a></li>
            <li><a id="logout_a" href="#" runat="server" onclick="if(!confirm('آیا قصد خروج از سیستم را دارید؟')) return false;"
                onserverclick="LogoutButton_Click">خروج از سیستم</a></li>
                    </ul>
                </div>
            </div>
        </div>
        <!--==============================content================================-->
        <div id="content">
            <div class="container_12">
                <div class="grid_12" style="vertical-align:middle;float: right">
                    <h2 class="top-1 p3">
                        مدیریت کاربران</h2>
                        <div align="center">
           <asp:MultiView ID="MultiView" runat="server" ActiveViewIndex="0">
                <asp:View ID="ShowView" runat="server">
                    <table style="width: 800px" title="کاربر" align="center">
                        <tr dir="rtl">
                            <td style="width: 30px">
                                &nbsp;
                            </td>
                            <td style="width: 120px; text-align: right;">
                                نام:
                            </td>
                            <td style="width: 100px; text-align: right;">
                                <asp:TextBox ID="FirstNameTextBox" runat="server" Width="100px"></asp:TextBox>
                            </td>
                            <td style="width: 100px" align="right">
                                نام خانوادگی:
                            </td>
                            <td style="width: 100px">
                                <asp:TextBox ID="LastNameTextBox" runat="server" Width="100px"></asp:TextBox>
                            </td>
                            <td style="width: 30px">
                                <asp:ImageButton ID="ClearImageButton" runat="server" OnClick="ClearImageButton_Click"
                                    OnClientClick="return false;" SkinID="ClearButton" />
                            </td>
                        </tr>
                        <tr >
                            <td style="width: 30px" align="center">
                                <asp:ImageButton ID="NewImageButton" runat="server" OnClick="NewImageButton_Click"
                                    SkinID="DatabaseAddButton" />
                            </td>
                            <td style="width: 120px; text-align: right;">
                                نام کاربری :
                            </td>
                            <td style="width: 100px; text-align: right;">
                                <asp:TextBox ID="UserNameTextBox" runat="server" Width="100px"></asp:TextBox>
                            </td>
                            <td align="right" style="width: 100px;">
                                سایز صفحه:
                            </td>
                            <td style="width: 100px" align="right">
                                <asp:DropDownList ID="PageSizeDropDownList" SkinID="SearchDropDownList" runat="server">
                                    <asp:ListItem Selected="True" Value="5">[پیش فرض]</asp:ListItem>
                                    <asp:ListItem Value="5">5 رکورد</asp:ListItem>
                                    <asp:ListItem Value="10">10 رکورد</asp:ListItem>
                                    <asp:ListItem Value="15">15 رکورد</asp:ListItem>
                                    <asp:ListItem Value="20">20 رکورد</asp:ListItem>
                                    <asp:ListItem Value="25">25 رکورد</asp:ListItem>
                                    <asp:ListItem Value="1000000">تمام رکورد ها</asp:ListItem>
                                </asp:DropDownList>
                            </td>
                            <td style="width: 30px">
                                <asp:ImageButton ID="SearchImageButton" runat="server" OnClick="SearchImageButton_Click"
                                    SkinID="SearchButton" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="6">
                                <asp:GridView ID="UserGridView" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                                    DataKeyNames="UserID" DataSourceID="UserEntityDataSource" HorizontalAlign="Center"
                                    OnSelectedIndexChanged="UserGridView_SelectedIndexChanged" PageSize="5" Width="100%"
                                    AllowSorting="True">
                                    <Columns>
                                        <asp:TemplateField>
                                            <ItemTemplate>
                                                <asp:ImageButton ID="SelectImageButton" runat="server" CommandName="Select" SkinID="SelectButton" /></ItemTemplate>
                                            <ItemStyle Width="25px" />
                                        </asp:TemplateField>
                                        <asp:BoundField DataField="UserID" HeaderText="UserID" ReadOnly="True" Visible="false"
                                            SortExpression="UserID" />
                                        <asp:BoundField DataField="UserName" HeaderText="نام کاربری" SortExpression="UserName">
                                            <ItemStyle Width="100px" />
                                        </asp:BoundField>
                                        <asp:BoundField DataField="FirstName" HeaderText="نام" SortExpression="FirstName">
                                        </asp:BoundField>
                                        <asp:BoundField DataField="LastName" HeaderText="نام خانوادگی" SortExpression="LastName" />
                                    </Columns>
                                </asp:GridView>
                            </td>
                        </tr>
                    </table>
                </asp:View>
                <asp:View ID="EditView" runat="server">
                    <asp:FormView ID="UserFormView" runat="server" DataSourceID="UserEntityDataSource"
                        DataKeyNames="UserID" DefaultMode="Insert" OnItemDeleted="UserFormView_ItemDeleted"
                        OnItemCommand="UserFormView_ItemCommand" Width="800px" HorizontalAlign="Center">
                        <EditItemTemplate>
                            <table border="0" cellpadding="0" cellspacing="0" style="width: 800px" align="center">
                                <tr>
                                    <td style="width: 80px" align="right">
                                        نام :
                                    </td>
                                    <td style="width: 160px" align="right">
                                        <asp:TextBox ID="FirstNameTextBox" runat="server" MaxLength="50" SkinID="TextBox"
                                            Text='<%# Bind("FirstName") %>'></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="FirstNameRequiredFieldValidator" runat="server" ControlToValidate="FirstNameTextBox"
                                            Display="Dynamic" ErrorMessage="*" ValidationGroup="Update"></asp:RequiredFieldValidator>
                                    </td>
                                    <td style="width: 80px" align="right">
                                        نام خانوادگی :
                                    </td>
                                    <td style="width: 160px" align="right">
                                        <asp:TextBox ID="LastNameTextBox" runat="server" MaxLength="50" SkinID="TextBox"
                                            Text='<%# Bind("LastName") %>'></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="LastNameRequiredFieldValidator" runat="server" ControlToValidate="LastNameTextBox"
                                            Display="Dynamic" ErrorMessage="*" ValidationGroup="Update"></asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 80px" align="right">
                                        نام کاربری :
                                    </td>
                                    <td style="width: 160px" align="right">
                                        <asp:TextBox ID="UserNameTextBox" runat="server" MaxLength="50" SkinID="TextBox"
                                            Text='<%# Bind("UserName") %>'></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="UserNameRequiredFieldValidator" runat="server" ControlToValidate="UserNameTextBox"
                                            Display="Dynamic" ErrorMessage="*" ValidationGroup="Update"></asp:RequiredFieldValidator>
                                    </td>
                                    <td>
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 80px" align="right">
                                        وضعیت دسترسی :
                                    </td>
                                    <td style="width: 160px" align="right">
                                        <asp:CheckBox ID="ActiveCheckBox" Checked='<%# Bind("IsActive") %>' runat="server"
                                            Text="فعال" />
                                    </td>
                                    <td style="width: 80px" align="right">
                                        مدیر سیستم :
                                    </td>
                                    <td style="width: 160px" align="right">
                                        <asp:CheckBox ID="AdminCheckBox" Checked='<%# Bind("IsAdmin") %>' runat="server"
                                            Text="مدیر سیستم" />
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 80px" align="right">
                                        کلمه عبور :
                                    </td>
                                    <td style="width: 160px" align="right">
                                        <asp:TextBox ID="PasswordTextBox" runat="server" MaxLength="50" Text='<%# Bind("Password") %>'
                                            SkinID="TextBox" TextMode="Password"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="PasswordRequiredFieldValidator" runat="server" ControlToValidate="PasswordTextBox"
                                            Display="Dynamic" ErrorMessage="*" ValidationGroup="Update"></asp:RequiredFieldValidator>
                                    </td>
                                    <td style="width: 80px; " align="right">
                                        تکرار کلمه عبور :
                                    </td>
                                    <td style="width: 160px" align="right">
                                        <asp:TextBox ID="RetypePasswordTextBox" runat="server" MaxLength="50" SkinID="TextBox"
                                            TextMode="Password"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="RetypePasswordRequiredFieldValidator" runat="server"
                                            ControlToValidate="RetypePasswordTextBox" Display="Dynamic" ErrorMessage="*"
                                            ValidationGroup="Update"></asp:RequiredFieldValidator>
                                        <asp:CompareValidator ID="PassowrdCompareValidator" runat="server" ControlToCompare="PasswordTextBox"
                                            ControlToValidate="RetypePasswordTextBox" Display="Dynamic" ErrorMessage="کلمه عبور و تکرار یکسان نمی باشند"
                                            ValidationGroup="Update"></asp:CompareValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4" align="left">
                                        <table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
                                            <tr>
                                                <td style="height: 15px">
                                                </td>
                                                <td align="left" valign="top" style="width: 110px;">
                                                </td>
                                                <td align="left" valign="top" style="width: 110px;">
                                                </td>
                                                <td align="left" valign="top" style="width: 110px;">
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="height: 15px">
                                                    &nbsp;
                                                </td>
                                                <td align="left" valign="top" style="width: 80px">
                                                    <asp:ImageButton ID="DeleteImageButton" runat="server" CausesValidation="False" CommandName="Delete"
                                                        SkinID="DeleteButton" OnClientClick="if (!confirm('آيا از حذف مطمئن هستيد؟')) return false;" />
                                                </td>
                                                <td align="left" valign="top" style="width: 80px">
                                                    <asp:ImageButton ID="UpdateImageButton" runat="server" CommandName="Update" SkinID="UpdateButton"
                                                        ValidationGroup="Update" OnClientClick="if (!confirm('آيا از اعمال تغییرات مطمئن هستيد؟')) return false;" />
                                                </td>
                                                <td align="left" valign="top" style="width: 80px">
                                                    <asp:ImageButton ID="CancelImageButton" runat="server" CommandName="Cancel" SkinID="CancelButton" />
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                        </EditItemTemplate>
                        <InsertItemTemplate>
                            <table border="0" cellpadding="0" cellspacing="0" style="width: 800px" align="center"
                                dir="rtl">
                                <tr>
                                    <td style="width: 150px" align="right">
                                        نام :
                                    </td>
                                    <td style="width: 250px" align="right">
                                        <asp:TextBox ID="FirstNameTextBox" runat="server" MaxLength="50" SkinID="TextBox"
                                            Text='<%# Bind("FirstName") %>'></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="FirstNameRequiredFieldValidator" runat="server" ControlToValidate="FirstNameTextBox"
                                            Display="Dynamic" ErrorMessage="*" ValidationGroup="Insert"></asp:RequiredFieldValidator>
                                    </td>
                                    <td style="width: 150px" align="right">
                                        نام خانوادگی :
                                    </td>
                                    <td style="width: 250px" align="right">
                                        <asp:TextBox ID="LastNameTextBox" runat="server" MaxLength="50" SkinID="TextBox"
                                            Text='<%# Bind("LastName") %>'></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="LastNameRequiredFieldValidator" runat="server" ControlToValidate="LastNameTextBox"
                                            Display="Dynamic" ErrorMessage="*" ValidationGroup="Insert"></asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 150px" align="right">
                                        نام کاربری :
                                    </td>
                                    <td style="width: 250px" align="right">
                                        <asp:TextBox ID="UserNameTextBox" runat="server" MaxLength="50" SkinID="TextBox"
                                            Text='<%# Bind("UserName") %>'></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="UserNameRequiredFieldValidator" runat="server" ControlToValidate="UserNameTextBox"
                                            Display="Dynamic" ErrorMessage="*" ValidationGroup="Insert"></asp:RequiredFieldValidator>
                                    </td>
                                    <td>
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 150px" align="right">
                                        وضعیت دسترسی :
                                    </td>
                                    <td style="width: 250px" align="right">
                                        <asp:CheckBox ID="ActiveCheckBox" Checked='<%# Bind("IsActive") %>' runat="server"
                                            Text="فعال" />
                                    </td>
                                    <td style="width: 150px" align="right">
                                        مدیر سیستم :
                                    </td>
                                    <td style="width: 250px" align="right">
                                        <asp:CheckBox ID="AdminCheckBox" Checked='<%# Bind("IsAdmin") %>' runat="server"
                                            Text="مدیر سیستم" />
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 150px" align="right">
                                        کلمه عبور :
                                    </td>
                                    <td style="width: 250px" align="right">
                                        <asp:TextBox ID="PasswordTextBox" runat="server" MaxLength="50" Text='<%# Bind("Password") %>'
                                            SkinID="TextBox" TextMode="Password"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="PasswordRequiredFieldValidator" runat="server" ControlToValidate="PasswordTextBox"
                                            Display="Dynamic" ErrorMessage="*" ValidationGroup="Insert"></asp:RequiredFieldValidator>
                                    </td>
                                    <td style="width: 150px;" align="right">
                                        تکرار کلمه عبور :
                                    </td>
                                    <td style="width: 250px" align="right">
                                        <asp:TextBox ID="RetypePasswordTextBox" runat="server" MaxLength="50" SkinID="TextBox"
                                            TextMode="Password"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="RetypePasswordRequiredFieldValidator" runat="server"
                                            ControlToValidate="RetypePasswordTextBox" Display="Dynamic" ErrorMessage="*"
                                            ValidationGroup="Insert"></asp:RequiredFieldValidator>
                                        <asp:CompareValidator ID="PassowrdCompareValidator" runat="server" ControlToCompare="PasswordTextBox"
                                            ControlToValidate="RetypePasswordTextBox" Display="Dynamic" ErrorMessage="کلمه عبور و تکرار یکسان نمی باشند"
                                            ValidationGroup="Insert"></asp:CompareValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4" align="left">
                                        <table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
                                            <tr>
                                                <td style="height: 15px">
                                                    &nbsp;
                                                </td>
                                                <td align="left" valign="top" style="width: 110px;">
                                                </td>
                                                <td align="left" valign="top" style="width: 110px;">
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="height: 15px">
                                                    &nbsp;
                                                </td>
                                                <td align="left" valign="top" style="width: 110px;">
                                                    <asp:ImageButton ID="InsertButton" runat="server" CommandName="Insert" SkinID="InsertButton"
                                                        ValidationGroup="Insert" />
                                                </td>
                                                <td align="left" valign="top" style="width: 110px;">
                                                    <asp:ImageButton ID="CancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                                                        SkinID="CancelButton" />
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                        </InsertItemTemplate>
                    </asp:FormView>
                </asp:View>
            </asp:MultiView>
        </div>
                </div>
                <div class="clear">
                </div>
            </div>
        </div>
    </div>
     <asp:EntityDataSource ID="UserEntityDataSource" runat="server" ConnectionString="name=DefaultEntityConnection"
        DefaultContainerName="DefaultEntityConnection" EnableDelete="True" EnableInsert="True"
        EnableUpdate="True" EntitySetName="Users" OnDeleted="UserEntityDataSource_Command"
        OnInserted="UserEntityDataSource_Command" OnUpdated="UserEntityDataSource_Command"
        Where="(@FirstName is null || it.FirstName LIKE '%' + @FirstName + '%') and (@LastName is null || it.LastName LIKE '%' + @LastName + '%') and (@UserName is null || it.UserName LIKE '%' + @UserName + '%')"
        CommandText="" EntityTypeFilter="" Select="" AutoGenerateOrderByClause="True">
        <WhereParameters>
            <asp:ControlParameter ControlID="FirstNameTextBox" Name="FirstName" Type="String" />
            <asp:ControlParameter ControlID="LastNameTextBox" Name="LastName" Type="String" />
            <asp:ControlParameter ControlID="UserNameTextBox" Name="UserName" Type="String" />
        </WhereParameters>
        <OrderByParameters>
            <asp:ControlParameter ControlID="UserGridView" Name="OrderBy" PropertyName="SortExpression"
                Type="String" />
        </OrderByParameters>
    </asp:EntityDataSource>
    <!--==============================footer=================================-->
    <footer>
        <p>Delta System Anahita © 2020 </p>
    </footer>
    </form>
</body>
</html>
